package com.example.xgakj.securityguard.base;

import android.app.Application;
import android.content.Context;

import com.example.xgakj.mylibrary.mvp.utils.SharedPreferencesUtil;
import com.example.xgakj.securityguard.BuildConfig;
import com.lzy.okgo.OkGo;
import com.socks.library.KLog;
import com.squareup.leakcanary.LeakCanary;
import com.squareup.leakcanary.RefWatcher;

/**
 * @author Administrator
 * @date 2017-10-15
 */

public class BaseApplication extends Application {
    private RefWatcher refWatcher;
    private static Context context;
    public static String baseUrl;
    @Override
    public void onCreate() {
        super.onCreate();
        context=this;
        KLog.init(BuildConfig.DEBUG);
        OkGo.getInstance().init(this);
        if (LeakCanary.isInAnalyzerProcess(this)) {
            return;
        }
        refWatcher= LeakCanary.install(this);
        baseUrl="http://" + getIP() + ":" + getRecordPort() + "/def.aspx?";
    }
    public static String getIP(){
        return SharedPreferencesUtil.getString(context,Parameters.SERVER_IP,"");
    }
    public static String getRecordPort(){
        return SharedPreferencesUtil.getString(context,Parameters.RECORD_PORT,"");
    }
}
